<?php
// +----------------------------------------------------------------------
// | Ghome
// +----------------------------------------------------------------------
// | Author: alex <gt199899@gmail.com>
// +----------------------------------------------------------------------
// | Version: 2014-04-03
// +----------------------------------------------------------------------
// | Copyright: Perfect Is Shit
// +----------------------------------------------------------------------
namespace Home\Controller;
use Think\Controller;
class InitController extends Controller{
	
	protected $eventClass;
	
    public function _initialize(){
    	$this->eventClass = A(CONTROLLER_NAME, 'Event');
    	$this->getNavigation(strtolower(CONTROLLER_NAME));
    }
	
    /**
     * 映射页头导航
     * @access protected
     * @param string $c 默认选中的导航
     * @author alex
     * @version 2014-04-09
     * @copyright ShowMore
     */
	protected function getNavigation($c = 'default'){
		$c = $c == 'index' ? 'default' : $c;
		//导航数据
		$data = array(
			array(
				'v'	=>	'default',
				'a'	=>	U('Home/Index/index'),
				'c'	=>	'link',
			),
			array(
				'v'	=>	'zce',
				'a'	=>	U('Home/ZCE/index'),
				'c'	=>	'link',
			),
			array(
				'v'	=>	'life',
				'a'	=>	U('Home/ZCE/index'),
				'c'	=>	'link',
			),
			array(
				'v'	=>	'Learn',
				'a'	=>	U('Home/ZCE/index'),
				'c'	=>	'link',
			),
		);
		foreach($data as $key=>$value){
			if($value['v'] == $c){
				$data[$key]['c'] = 'linked';
			}
			else{
				continue;
			}
		}
		unset($key, $value);
		$this->assign('navigation', $data);
	}
	
}